import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author dreamcatcher
 * @date 2022/3/2 18:29
 * 限定符
 */
public class RegExp05 {
    public static void main(String[] args) {
//        //指定字符重复0次到n次
//        String regStr = "(abc)*";
//        String content = "abcabcabcabccbaabcbabc";
//
//       //指定字符重复1次到n次
//          String regStr = "m+(abc)*";
//          String content = "mabcabmabcabcabcmmmabc";


//        //指定n个前面字符
//        String regStr = "a{3}|[abc]{3}";
//        String content = "aaaajasoabbabcbbbccccba";

        //java默认是贪婪匹配
        String regStr = "1{3,5}";
        String content = "111111";


        Pattern pattern = Pattern.compile(regStr);
        Matcher matcher = pattern.matcher(content);
        while (matcher.find()){
            System.out.println(matcher.group(0));
        }
    }
}
